<template>
	<view class="quanbu">
		<view class="zhuYe">

			<image src="../../../static/images/lzx/图层 3@2x.png" class="zhuYeTouXiang"></image>
			<view class="huanYing">大美汽修厂，欢迎您</view>
		</view>
		<view class="fangkuai1">
			<image @click="scan_btn" src="../../../static/images/lzx/扫码.png" class="verificationCode0" />
			<div @click="scan_btn">输入核销码</div>
			<image @click="enter_btn" src="../../../static/images/lzx/输入2.png" class="verificationCode" />
			<div @click="enter_btn">扫码核销</div>
		</view>
		<view class="caidan">
			<u-grid :border="false" col="4">
				<u-grid-item v-for="(listItem,listIndex) in list" :key="listIndex">
					<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="listItem.name" :size="22"
						@click="nav_btn(listIndex)"></u-icon>
					<text class="grid-text">{{listItem.title}}</text>
				</u-grid-item>
			</u-grid>
			<u-toast ref="uToast" />
		</view>
		<view class="notice">
			<image src="../../../static/images/lzx/消息-信息.png" class="xinXI"></image>
			<view class="noticeWZ">最新通知</view>
			<view class="noticeWZ1" @click="more_btn">今日需上门取车任务共32单</view>
			<image src="../../../static/images/lzx/收起箭头小.png" class="xiaoJianTou"></image>





			<uni-table emptyText="暂无更多数据" style="margin-top: 50rpx;">
				<!-- 表头行 -->
				<uni-tr>
					<uni-th style="text-align: center;" align="center">用户</uni-th>
					<uni-th style="text-align: center;" align="center">服务项目</uni-th>
					<uni-th align="left" style="text-align: center;">时间</uni-th>
				</uni-tr>
				<!-- 表格数据行 -->
				<uni-tr v-for="(item, index) in orderList" :key="index">
					<uni-td style="text-align: center;">{{item.cheUser.username}}</uni-td>
					<uni-td style="text-align: center;">{{getServiceName(item.cheOrder.serviceId) }}</uni-td>
					<uni-td>{{item.commentTime}}</uni-td>
				</uni-tr>


			</uni-table>



		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderList:[],
				list: [{
						name: '../../../static/images/lzx/统计@3x.png',
						title: '经营统计',

					},
					{
						name: 'lock',
						title: '核销记录'
					},
					{
						name: 'star',
						title: '收入明细'
					},
					{
						name: 'hourglass',
						title: '订单管理'
					},
					{
						name: 'home',
						title: '卡券管理'
					},
					{
						name: 'star',
						title: '维修任务'
					},
					{
						name: 'star',
						title: '评价管理'
					},
					{
						name: 'star',
						title: '商品资料'
					},
					{
						name: 'star',
						title: '活动发布'
					},
				],
			}
		},
		created() {
			  this.getList();
			  // this.getCode();
				},
		
		methods: {
		getServiceName(serviceId) {
		      return serviceId === 1 ? '基础维修' :
		             serviceId === 2 ? '常规保养' :
		             serviceId === 3 ? '快速洗车' : '未知服务';
		    },
			getList() {
					let that=this;
			this.$http({
				url:'/api/orders/orders/list',
				method:'GET',
				success(res){
					that.orderList = res.data.rows;
					console.log(res);
					console.log("============")
					console.log(that.orderList)
				}
			})		
					},
			
			
			scan_btn() {
				uni.$u.route('/pages/ls/scanCodeVerification/scanCodeVerification')
			},
			enter_btn() {
				uni.$u.route('/pages/ls/enterVerificationCode/enterVerificationCode')
			},
			nav_btn(index) {
				if (index == 0) {
					uni.$u.route('/pages/wpc/jytj/jytj')
				} else if (index == 1) {
					uni.$u.route('/pages/ys/hexiaojilu/hexiaojilu')
				} else if (index == 2) {
					uni.$u.route('/pages/ly/budget/budget')
				} else if (index == 3) {
					uni.$u.route('/pages/wpc/ddgl/ddgl')
				} else if (index == 4) {
					uni.$u.route('/pages/ryx/Coupons-Manage/Coupons-Manage')
				} else if (index == 5) {
					uni.$u.route('/pages/ys/weixiurenwu1/weixiurenwu1')
				} else if (index == 6) {
					uni.$u.route('/pages/ly/appraise/appraise')
				} else if (index == 7) {
					uni.$u.route('/pages/ryx/merchantInformation/merchantInformation')
				} else if (index == 8) {
					uni.$u.route('/pages/lzx/business/eventPosting')
				}
			},
			more_btn() {
				uni.$u.route('/pages/wpc/ddgl/ddgl')
			}
		}
	}
</script>

<style>
	.quanbu {
		position: relative;
	}

	.zhuYe {

		height: 350rpx;
		width: 100%;
		background-color: #297efa;
	}

	.zhuYeTouXiang {

		width: 120rpx;
		height: 120rpx;
		position: absolute;
		top: 100rpx;
		left: 60rpx;
		border-radius: 50%;
		-webkit-animation: ani 2s linear infinite;

	}

	@keyframes ani {
		0% {
			box-shadow: 0 0 0px #ff8329
		}

		25% {
			box-shadow: 0 0 10px #ff8329
		}

		50% {
			box-shadow: 0 0 20px #ff8329
		}

		75% {
			box-shadow: 0 0 10px #ff8329
		}

		100% {
			box-shadow: 0 0 0px #ff8329
		}
	}

	.huanYing {
		color: white;
		font-size: 18px;
		position: absolute;
		top: 140rpx;
		left: 210rpx;
	}

	.fangkuai1 {
		width: 90%;
		height: 200rpx;
		background-color: #ffffff;
		position: absolute;
		left: 5%;
		top: 250rpx;
		border-radius: 20rpx;
	}

	.verificationCode0 {
		height: 60rpx;
		width: 60rpx;
		position: absolute;
		left: 15%;
		top: 14%;

	}

	.fangkuai1 div {
		position: absolute;
		left: 15%;
		top: 70%;
	}

	.fangkuai1 div:nth-child(2) {
		position: absolute;
		left: 65%;
		top: 70%;
	}

	.verificationCode {
		width: 60rpx;
		height: 60rpx;
		position: absolute;
		left: 65%;
		top: 15%;
	}

	.caidan {
		width: 90%;
		height: 350rpx;
		background-color: #ffffff;
		position: absolute;
		left: 5%;
		top: 500rpx;
		border-radius: 20rpx;
	}

	.grid-text {
		font-size: 14px;
		color: #909399;
		padding: 10rpx 0 20rpx 0rpx;
		/* #ifndef APP-PLUS */
		box-sizing: border-box;
		/* #endif */
	}

	.notice {
		width: 90%;
		height: 350rpx;
		background-color: #ffffff;
		position: absolute;
		left: 5%;
		top: 900rpx;
		border-radius: 20rpx;
	}

	.xinXI {
		height: 30rpx;
		width: 30rpx;
		margin-top: 20rpx;
		margin-left: 20rpx;
	}

	.noticeWZ {
		margin-top: -42rpx;
		margin-left: 60rpx;
	}

	.noticeWZ1 {
		position: absolute;
		top: 18rpx;
		right: 50px;
		color: red;

	}

	.xiaoJianTou {
		width: 20rpx;
		height: 20rpx;
		position: absolute;
		top: 25rpx;
		right: 32px;

	}
</style>